package org.bsc.mgwt.client.widget;

import org.bsc.mgwt.client.MobileResourceAware;
import org.bsc.mgwt.client.res.ProgressPanelCss;

import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHTML;
import com.googlecode.mgwt.ui.client.widget.ProgressIndicator;

public class ProgressHeaderIndicator extends FlowPanel implements MobileResourceAware, HasHTML {

	protected final HTML title = new HTML("loading ...");
	
	public ProgressHeaderIndicator() {
		mobileBundle.progressPanel().ensureInjected();
		
		super.addStyleName(mobileBundle.progressPanel().panel());
		
		title.addStyleName(mobileBundle.progressPanel().message());
		
		add( title );
		
		ProgressIndicator indicator = new ProgressIndicator();
		indicator.addStyleName(mobileBundle.progressPanel().spinner());
		//indicator.getElement().getStyle().setDisplay(Display.NONE);

		add( indicator );
	}

	public ProgressHeaderIndicator( ProgressPanelCss css ) {
		css.ensureInjected();
		
		super.addStyleName(css.panel());
		
		title.addStyleName(css.message());
		
		add( title );
		
		ProgressIndicator indicator = new ProgressIndicator();
		indicator.addStyleName(css.spinner());
		//indicator.getElement().getStyle().setDisplay(Display.NONE);

		add( indicator );
	}

	@Override
	public String getHTML() {
		return title.getHTML();
	}

	@Override
	public void setHTML(String html) {
		title.setHTML(html);
	}

	@Override
	public String getText() {
		return title.getText();
	}

	@Override
	public void setText(String text) {
		title.setText(text);
	}
	
}